﻿<?xml version="1.0" encoding="utf-8"?>

<xs:schema id="Config" targetNamespace="http://ProjectBase/Config.xsd" elementFormDefault="qualified" xmlns="http://ProjectBase/Config.xsd" xmlns:menu="http://ProjectBase/Config.xsd" xmlns:projectBaseSection="http://ProjectBase/Config.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:annotation id="configAnnotation">
        <xs:documentation>
            This Schema should help developers to manipulate with config files.
            At this moment the Menu.Config and Project.config uses this template.

            .config extension allows simple (but effective) reuse of IIS .config files handling:
            They are 'never' returned to user when accessed using URL
        </xs:documentation>
    </xs:annotation>

    <xs:simpleType name="roleNames">
        <xs:annotation>
            <xs:documentation>
                The Application dependent and exact enumaration-list of the 'roleNames' .
                This list of the 'roleNames' must be adjusted to the application needs (Role used in the application)
            </xs:documentation>
        </xs:annotation>
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string" />
            </xs:simpleType>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="Administrator" />
                    <xs:enumeration value="RegisteredUser" />
                    <xs:enumeration value="Viewer" />
                    <!-- TODO add other for your project to support intelli-sense -->
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:simpleType name="roleGroups">
        <xs:annotation>
            <xs:documentation>
                This type helps with the intelli-sense. There are some predifined values, but any other string value can be provided.
                roleGroup name should belong to some of yours predefined roleGroups
            </xs:documentation>
        </xs:annotation>
        <xs:union>
            <xs:simpleType>
                <xs:restriction base="xs:string" />
            </xs:simpleType>
            <xs:simpleType>
                <xs:restriction base="xs:string">
                    <xs:enumeration value="All" />
                    <xs:enumeration value="Admin" />
                    <xs:enumeration value="Read" />
                    <xs:enumeration value="OneRow" />
                    <!-- TODO add other for your project to support intelli-sense -->
                </xs:restriction>
            </xs:simpleType>
        </xs:union>
    </xs:simpleType>

    <xs:element name="project">
        <xs:complexType>
            <xs:annotation>
                <xs:documentation>
                    All the needed settings are available via Project.Settings!
                    Most of the values have the defaults.
                </xs:documentation>
            </xs:annotation>
            <xs:choice minOccurs="0" maxOccurs="unbounded">
                <xs:sequence minOccurs="0">
                    <xs:element ref="writeActionList" />
                </xs:sequence>
                <xs:sequence minOccurs="0">
                    <xs:element name="project">
                        <xs:annotation>
                            <xs:documentation>
                                'Project.Settings'
                                This element expects the 'add' elements with the key/value pairs attribute.
                                the Common.IProjectSettings interface
                                (which is accessible on every place of the application: 'Project.Settings'
                                is filled with these values.
                                For every 'Key' value matching the 'IProjectSettings' PropertyName
                                is the 'Value' attribute use to set its value.
                            </xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                            <xs:choice minOccurs="0" maxOccurs="unbounded">
                                <xs:element ref="add" />
                            </xs:choice>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
                <xs:sequence minOccurs="0">
                    <xs:element ref="settings" />
                </xs:sequence>
                <xs:sequence minOccurs="0">
                    <xs:element ref="configurationFile" />
                </xs:sequence>
                <xs:sequence minOccurs="0">
                    <xs:element ref="rolesConvertor" />
                </xs:sequence>
                <xs:sequence minOccurs="0">
                    <xs:element ref="daoSession" />
                </xs:sequence>
            </xs:choice>
        </xs:complexType>
    </xs:element>

    <xs:element name="menu">
        <xs:annotation>
            <xs:documentation>
                Root element for the menu.config file
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:sequence minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="roleGroup" />
                </xs:sequence>
                <xs:sequence minOccurs="1" maxOccurs="unbounded">
                    <xs:element ref="controllerOrNode" />
                </xs:sequence>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="roleGroup">
        <xs:annotation>
            <xs:documentation>
                Abbreviation for the role (repeating) list. You can define some role list (e.g. all) and name them (e.g. 'all').
                This 'roleGroup' element can be therefore reused for access rights definition on the controller or node declaration.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:sequence minOccurs="1" maxOccurs="unbounded">
                    <xs:element ref="roleGranted" />
                </xs:sequence>
            </xs:sequence>
            <xs:attribute name="name" type="xs:ID" use="required">
                <xs:annotation>
                    <xs:documentation>
                        Unique name of this roles group. This name then could be used as the reference
                        for access rights setting on particular controller or node
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="controllerOrNode">
        <xs:complexType>
            <xs:sequence>

                <xs:choice maxOccurs="unbounded">

                    <xs:sequence maxOccurs="unbounded">

                        <xs:element name="roleGroup">
                            <xs:annotation>
                                <xs:documentation>
                                    Access granting (and also display in the Main TreeView managing) setting
                                </xs:documentation>
                            </xs:annotation>
                            <xs:complexType>

                                <xs:sequence>
                                    <xs:sequence minOccurs="0" maxOccurs="unbounded">
                                        <xs:element ref="action" />
                                    </xs:sequence>
                                </xs:sequence>

                                <xs:attribute name="name" type="menu:roleGroups" use="required">
                                    <xs:annotation>
                                        <xs:documentation>
                                            The name of the roleGroup to which will be the rights granted/denied.
                                        </xs:documentation>
                                    </xs:annotation>
                                </xs:attribute>

                                <xs:attribute name="isVisible" type="xs:boolean" default="true">
                                    <xs:annotation>
                                        <xs:documentation>
                                            Optional setting which allows hide this node in the Menu  for current role.
                                            It could be handy when only one or few actions are allowed for current role + selected controller.
                                            Default value is 'true' - node will be displayed.
                                        </xs:documentation>
                                    </xs:annotation>
                                </xs:attribute>

                            </xs:complexType>
                        </xs:element>
                    </xs:sequence>

                    <xs:sequence maxOccurs="unbounded">
                        <xs:element ref="roleGranted" />
                    </xs:sequence>

                </xs:choice>


                <xs:sequence minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="controllerOrNode" />
                </xs:sequence>
            </xs:sequence>

            <xs:attribute name="name" type="xs:ID" use="required">
                <xs:annotation>
                    <xs:documentation>
                        Unique name, controller or node (cluster for controllers whithout any real controller).
                        This name can be referenced as parent.
                        This attribute is of Type ID and therefore cannot be used twice. Also can be referenced
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="text" type="xs:string" default="">
                <xs:annotation>
                    <xs:documentation>
                        Text which should be displayed as the Menu item description. if not provided the 'name' attribute value is used
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="href" type="xs:string" default="">
                <xs:annotation>
                    <xs:documentation>
                        The hypertext reference which should be provided in the 'href' attribute of this item.
                        If null or empty, the inner engine will create the URL using the 'name' as controllerName + default action name
                        (for usual controller leave this empty)
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="imagePath" type="xs:string" default="">
                <xs:annotation>
                    <xs:documentation>
                        The relative path to the image which should be displayed before the item name.
                        The path should be in the style 'i/menu/picture.gif'.
                        If provided value equals to '.' then inner engine will create the path as: 'i/menu/' + name + '.gif'.
                        (for usual controller just put the image of 'controllerName.gif' in the 'i/menu/' and provide
                        value 'imagePath="."')
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="expanded" type="xs:boolean" default="false">
                <xs:annotation>
                    <xs:documentation>
                        true means that at the session start this node will be expanded.
                        The next behavior (expand collapse) is managed by user's last setting
                        (default is true - expanded)
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="writeActionList">
        <xs:annotation>
            <xs:documentation>
                This list contains the collection of all write (Add, Update, Delete ....) actions.
                These actions will be removed from the menus, actions, buttons when ReadOnly mode is On!
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:sequence minOccurs="1" maxOccurs="unbounded">
                    <xs:element name="action">
                        <xs:annotation>
                            <xs:documentation>
                                Define the action as the WRITE one. This allowes to handle this information
                                in AOP Filter, e.g. for removing it from the offered action list for ReadOnly access.
                                (Until used in AOP filter - like RightAccess - this setting is not granted)
                                Default ProjectBaseSettings provider extends this information with all actions decorated with Transaction attribute
                            </xs:documentation>
                        </xs:annotation>
                        <xs:complexType>
                            <xs:attribute name="name" type="xs:string" use="required">
                                <xs:annotation>
                                    <xs:documentation>
                                        The name of the action which is Write (persists data).
                                        RightAccess filter attribute will remove all these actions from the list of IActionItems and IButtonItems.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:attribute>
                            <xs:attribute name="controller" type="xs:string" use="optional">
                                <xs:annotation>
                                    <xs:documentation>
                                        If controller name is specified, then only the pair Action (name attribute) and Controller is evaluated.
                                        If this attribute is missing, than this Action is evaluated for all controllers.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:attribute>
                            <xs:attribute name="exclude" type="xs:boolean" use="optional">
                                <xs:annotation>
                                    <xs:documentation>
                                        Allowes to exclude this action + controller combination from the WriteAction list.
                                        There could be some cases when you need to persist stuff even for the Viewers or Anonyms.
                                        As a good example could serve AccessStatistics management or Changing CurrentRole on Home controller.
                                    </xs:documentation>
                                </xs:annotation>
                            </xs:attribute>
                        </xs:complexType>
                    </xs:element>
                </xs:sequence>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="settings">
        <xs:annotation>
            <xs:documentation>
                Project settings. These values are cached until Project.config is changed.
                This allows to set default row count for list view, validation on request etc.
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="1">
                <xs:element name="connectionStringNameAdoNet" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            The name of the connection string to be used for DbConnection on DataLayer for ADO.NET
                            This could be different from the NHibernate (default is "ProjectAdoNet").
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    The name of the connection string to be used for DbConnection on DataLayer for ADO.NET
                                    This could be different from the NHibernate (default is "ProjectAdoNet").
                                    Suggestion: use different for NHibernate to have different Connection pools.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>

                <xs:element name="defaultListRowCount" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            How many rows should be displayed in the list view?
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:short" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    Set the default value for the list view. e.g. 25
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="enableSessionKeeper" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            There is built in Session keeper - Javascript caller to Home.mvc controller. It fires the action every 4 minutes.
                            This will make user satisfy, even during the lunch time...
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    True will call (via JS) every 4 minutes to the server and keep session alive.
                                    False will disable that behavior
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="prefixForNotFoundTranslation" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Resource manager tries to inform you, that searched key was not found - and not localized.
                            Such a returned value could be decorated with some mark at the beginning (e.g. '$')
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    The prefix for not found localizaton - e.g. '$'
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="validateRequestOnController" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            ASP.NET MVC controllers do Validate every request if there are no dangerous html tags e.g. '&lt;script&gt;'
                            It will disable the correct behaviour even in situations, that you are taking care about these issues,
                            but need to store such strings (textboxes, richtextboxes etc.)
                            Therefore you can disable that behavior for all controllers here.
                            (or in constructor of specific one: observe WebController)
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    False will disable validating. Even the '&lt;script&gt;' will be processed.
                                    If set to false, keep in mind the possible risk
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="factoryProviderType" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            There is default IFactoryProvider, profiting from StructureMap.
                            But you can simply change it to any other class which implements IFactoryProvider interface.
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    The full name of the class which will serve as the IFactoryProvider.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="useCurrentRole" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Application can behave in two different ways with the user role-set.
                            1) User can select one role as the active one == "CurrentRole".
                            Access Rights are than based on this single role settings
                            2) User can be evaluated with the complete role-set (mish-mash mode).
                            If currently asked controller's action is allowed at least for one of the users's roles
                            -- access is granted
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    True will allow users to select on of their roles as CurrentRole.
                                    False will grant every action which is allowed for at least one role in the user role-set.
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="fileCacheDbPath" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            A path to the file, which will trigger the clear of the ADO.NET cache (whenever is changed).
                            Default value is "DbCache.xml" nested in the "\App_Data" folder.
                            For a web-farm it could be some external target (e.g "C:\DbCache.xml")
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    A path to the file, which will trigger the clear of the DB cache (whenever is changed).
                                    Default value is "DbCache.xml" nested in the "\App_Data" folder.
                                    For a web-farm it could be some external target (e.g "C:\DbCache.xml")
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="fileCacheStaticPath" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            A path to the file, which will trigger the clear of the Static cache (whenever is changed).
                            AllowFileCacheDependencyForStatic setting must be set to "true".
                            Default value is "StaticCache.xml" nested in the "\App_Data" folder.
                            For a web-farm it could be some external target (e.g "C:\StaticCache.xml")
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    A path to the file, which will trigger the clear of the Static cache
                                    (whenever is changed).
                                    AllowFileCacheDependencyForStatic setting must be set to "true".
                                    Default value is "StaticCache.xml" nested in the "\App_Data" folder.
                                    For a web-farm it could be some external target (e.g "C:\StaticCache.xml")
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="allowFileCacheDependencyForStatic" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Default value is "false".
                            On a web-farm, if set to true, static fields are cleared when
                            file in the path 'FileCacheStaticPath' is changed
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    Default value is "false".
                                    On a web-farm, if set to true, static fields are cleared when
                                    file in the path 'FileCacheStaticPath' is changed
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>

              <xs:element name="daoDefaultLikeCollation" minOccurs="0">
                <xs:annotation>
                  <xs:documentation>
                    The default collation for a LIKE expressions. (default value is "Latin1_General_CI_AS").
                    Could be changed to support Accent Insensitive search
                  </xs:documentation>
                </xs:annotation>
                <xs:complexType>
                  <xs:attribute name="value" type="xs:string" use="required">
                    <xs:annotation>
                      <xs:documentation>
                        The default collation for a LIKE expressions. (default value is "Latin1_General_CI_AS").
                        Could be changed to support Accent Insensitive search
                      </xs:documentation>
                    </xs:annotation>
                  </xs:attribute>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="configurationFile">
        <xs:annotation>
            <xs:documentation>
                Section containing relative path for other confi files
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence>
                <xs:element name="dataConfig" minOccurs="0" maxOccurs="unbounded">
                    <xs:annotation>
                        <xs:documentation>
                            NHibernate configuration path specification
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="path" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    the path to the NHibernate.config. E.g. "Config/NHibernate.config"
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>

                <xs:element name="menuConfig" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            Menu configuration file. this file is used (in basic implementation) for two purposes:
                            1) As the Right Access evaluator
                            2) Navigation provider
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="path" type="xs:string" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    the path to the Menu.config. E.g. "Config/Menu.config"
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>

    </xs:element>

    <xs:element name="rolesConvertor">
        <xs:annotation>
            <xs:documentation>
                Do you need external role provider? Is it suitable to convert external role names
                into the application ones? Do it here
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence minOccurs="1" maxOccurs="unbounded">
                <xs:element ref="role" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="daoSession">
        <xs:annotation>
            <xs:documentation>
                Easy switch for enabling or disabling the Sessions for different Dao.
                Standard way is Enable the NHibernate only.
                In some cases, when the XML Daos are used, you can enable the XmlSessions.
                When there are ADO.NET DbSessions (e.g. for StoredProcedures which cannot be managed via NHibernate)
                allow the DbSession
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:sequence minOccurs="0" maxOccurs="1">
                <xs:element name="enableDb" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            enable NHibernate Dao Sessions
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    The default value (if this element is not provided) is true.
                                    That will create the Sessions for your Daos using NHibernate Factory
                                    and make them accesible during the Request lifetime
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="enableNHibernate" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            enable NHibernate Dao Sessions
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    The default value (if this element is not provided) is true.
                                    That will create the Sessions for your Daos using NHibernate Factory
                                    and make them accesible during the Request lifetime
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
                <xs:element name="enableXml" minOccurs="0">
                    <xs:annotation>
                        <xs:documentation>
                            enable NHibernate Dao Sessions
                        </xs:documentation>
                    </xs:annotation>
                    <xs:complexType>
                        <xs:attribute name="value" type="xs:boolean" use="required">
                            <xs:annotation>
                                <xs:documentation>
                                    The default value (if this element is not provided) is true.
                                    That will create the Sessions for your Daos using NHibernate Factory
                                    and make them accesible during the Request lifetime
                                </xs:documentation>
                            </xs:annotation>
                        </xs:attribute>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="roleGranted">
        <xs:annotation>
            <xs:documentation>
                Access granting (and also display in the Main TreeView managing) setting
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>

            <xs:sequence>
                <xs:sequence minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="action" />
                </xs:sequence>
            </xs:sequence>

            <xs:attribute name="name" type="menu:roleNames" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The name of the role which is granted. Compared value is taken from 'ApplicationRoles.User.CurrentRole.RoleName'.
                        If this values do not match - access is denied, and item is not displayed
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>

            <xs:attribute name="accessForListed" type="menu:access" default="grant">
                <xs:annotation>
                    <xs:documentation>
                        For all action elements used: this switch decides if they are 'granted' or 'denied'.
                        This setting also results in inverse behavior for all unlisted actions
                        (e.g. if set to 'grant' and listed is 'GetAllCodeLists' every action other thane this is forbidden)
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>

            <xs:attribute name="isReadOnly" type="xs:boolean" default="false">
                <xs:annotation>
                    <xs:documentation>
                        This is powerful switch, which should be correctly handled in other code. If set to true - Model.IsReadOnly is set to true.
                        This will rollback any transaction at the end. Every 'known' edit action will be hidden and forbidden.
                        BUT: if there is a new 'generally-unknown' action which provides editing - it's hiding and forbidden must be set manually.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>

            <xs:attribute name="isVisible" type="xs:boolean" default="true">
                <xs:annotation>
                    <xs:documentation>
                        Optional setting which allows hide this node in the Menu  for current role.
                        It could be handy when only one or few actions are allowed for current role + selected controller.
                        Default value is 'true' - node will be displayed.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>

        </xs:complexType>
    </xs:element>

    <xs:element name="action">
        <xs:annotation>
            <xs:documentation>
                If at least one actionGranted element is used, only actions in that list are allowed.
                If only one
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="name" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The name of the action which is granted. Compared value is taken from 'ApplicationRoles.User.CurrentRole.RoleName'.
                        If this values do not match - access is denied, and item is not displayed
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:simpleType name="access">
        <xs:annotation>
            <xs:documentation>
                This enumeration allows to decide, if the listed actions (inside the roleGranted element) are forbidden or allowed
            </xs:documentation>
        </xs:annotation>
        <xs:restriction base="xs:string">
            <xs:enumeration value="grant" />
            <xs:enumeration value="deny" />
        </xs:restriction>
    </xs:simpleType>

    <xs:element name="role">
        <xs:annotation>
            <xs:documentation>
                If at least one actionGranted element is used, only actions in that list are allowed.
                If only one
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="roleProviderName" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>
                        Key value - can be used only ones!
                        The name of external role to be mapped to the application one (provided in the name attribute)
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="applicationRoleName" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The application role, which will map the external role name (provided in the value attribute).
                        There could be more then one 'applicationRoleName' value used for mapping external role.
                        Other word: More external roleNames can be mapped to one applicationRoleName.
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

    <xs:element name="add">
        <xs:annotation>
            <xs:documentation>
                Simply add some settings for your project (to be correctly read in your ProjectSettingsProvider).
            </xs:documentation>
        </xs:annotation>
        <xs:complexType>
            <xs:attribute name="key" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>
                        The name of the property of the Common.IProjectSettings interface
                        to be filled with the 'Value' attribute content
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
            <xs:attribute name="value" type="xs:string" use="required">
                <xs:annotation>
                    <xs:documentation>
                        Value of this attribute will be set to the Common.IProjectSettings property
                        (matching the 'Key' attribute and the PropertyName)
                    </xs:documentation>
                </xs:annotation>
            </xs:attribute>
        </xs:complexType>
    </xs:element>

</xs:schema>